-
Notifications
You must be signed in to change notification settings - Fork 961
Deterministic daemons: CLN_DEV_SET_TIME and CLN_DEV_ENTROPY_SEED #8556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
rustyrussell
merged 12 commits into
ElementsProject:master
from
rustyrussell:deterministic-daemons
Nov 13, 2025
Merged
Deterministic daemons: CLN_DEV_SET_TIME and CLN_DEV_ENTROPY_SEED #8556
rustyrussell
merged 12 commits into
ElementsProject:master
from
rustyrussell:deterministic-daemons
Nov 13, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1fb7961 to
2047615
Compare
…LN_DEV_ENTROPY_SEED Only in developer mode, ofc. Notes: 1. We have to move the initialization before the lightningd main trace_start, since that uses pseudorand(). 2. To make the results stable, we need to use per-caller values to randbytes(). Otherwise external timing changes the call order. Signed-off-by: Rusty Russell <[email protected]>
This allows us to override it for deterministic results. Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
…tion for timeouts. This is immune to things like clock changes, and has the convenient side-effect that it will *not* be overridden when we override time for developer purposes. Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
2047615 to
328d8bb
Compare
Except for tracing, that sticks with time_now(). Signed-off-by: Rusty Russell <[email protected]>
…ith CLN_DEV_ENTROPY_SEED. Signed-off-by: Rusty Russell <[email protected]>
Signed-off-by: Rusty Russell <[email protected]>
…istincoming. This ensures that bolt11/bolt12 selection of routehints/blinded paths is always the same. Signed-off-by: Rusty Russell <[email protected]>
…itialblockdownload. Signed-off-by: Rusty Russell <[email protected]>
We have to add a send_and_mine_block() for cases where we want to get a txid and then mine it (for canned blocks, we mine it then figure out which tx it was!). And fix up out-by-one in saving blocks. Signed-off-by: Rusty Russell <[email protected]>
328d8bb to
5073073
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Depends on #8555
This attempts to make our behavior deterministic, and robust against changes, so we can generate repeatable examples. This is not entirely successful: when we interact with other daemons, timing can be an issue (such as multifundchannel), but it works in a limited way.
Changelog-None: development stuff only